<div id="menu">
	<ul id="menu-items">
		<?php foreach($menuitems as $menuitem): ?>
			<?php if($menuitem == $selected_item): ?>
				<?php if(isset($menuitem['submenu'])): //There is a submenu?> 
					<li class="dropdown" id="selected_item">
						<span><?php echo anchor(base_url(). $menuitem['url'], $menuitem['name']);?></span>
						<ul>
							<?php foreach($menuitem['submenu'] as $submenuitem):?>
							<li><?php echo anchor(base_url().$submenuitem['url'], $submenuitem['name']);?></li>
							<?php endforeach;?>
						</ul>
					</li>
				<?php else:?>
					<li class="nodrop" id="selected_item"><span><?php echo anchor(base_url(). $menuitem['url'], $menuitem['name']);?></span></li>
				<?php endif;?>
			<?php else: //Is not selected item?>
				<?php if(isset($menuitem['submenu'])): //There is a submenu?> 
					<li class="dropdown">
						<span><?php echo anchor(base_url(). $menuitem['url'], $menuitem['name']);?></span>
						<ul>
							<?php foreach($menuitem['submenu'] as $submenuitem):?>
							<li><?php echo anchor(base_url().$submenuitem['url'], $submenuitem['name']);?></li>
							<?php endforeach;?>
						</ul>
					</li>
				<?php else:?>
					<li class="nodrop"><span><?php echo anchor(base_url(). $menuitem['url'], $menuitem['name']);?></span></li>
				<?php endif;?>
			<?php endif;?>
		<?php endforeach;?>
	</ul>
</div>

